import requests
import re


url = "https://quotes.toscrape.com/tag/love/"
response = requests.get(url)
html = response.text
types = re.findall(r'<a class="tag" style="font-size: (.*?)px" href="/tag/(.*?)/">(.*?)</a>',html,re.S)
for type in types:
    now_type=type[1]
    now_url=f"https://quotes.toscrape.com/tag/{now_type}/"
    res = requests.get(now_url)
    now_html = res.text
    texts = re.findall(r'<span class="text" itemprop="text">“(.*?)”</span>', now_html, re.S)
    authors = re.findall(r' <small class="author" itemprop="author">(.*?)</small>', now_html, re.S)
    tags = re.findall(r'<meta class="keywords" itemprop="keywords" content="(.*?)" /', now_html, re.S)
    types = re.findall(r'<a class="tag" style="font-size: (.*?)px" href="/tag/(.*?)/">(.*?)</a>', now_html, re.S)
    for item in range(len(texts)):
        print(f"正在爬取{now_type}里面的第{item+1}条数据...")
        print("文章： "+texts[item])
        print("作者： "+authors[item])
        print("标签： "+tags[item])
